package com.beaven.imserver.net.bean.api.group;

import com.beaven.imserver.net.bean.db.Group;
import com.google.common.base.Strings;
import com.google.gson.annotations.Expose;

/**
 * author: Beaven
 * time: 2017/6/1 19:24
 */
public class UpdateGroupModel {

  @Expose
  private String name;

  @Expose
  private String groupId;

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getGroupId() {
    return groupId;
  }

  public void setGroupId(String groupId) {
    this.groupId = groupId;
  }

  public static boolean check(UpdateGroupModel model) {
    return model != null && (!Strings.isNullOrEmpty(model.name)) && (!Strings.isNullOrEmpty(
        model.groupId));
  }

  public Group update(Group group) {
    if (!Strings.isNullOrEmpty(name)) {
      group.setName(name);
    }
    return group;
  }
}
